using System;

namespace BoxBinary.AspectCache.Core.ErrorLogging
{
    /// <summary>
    /// 
    /// </summary>
    public interface ILogProvider
    {
        /// <summary>
        /// The title of the log. If null, during SaveLog(), this should automatically be populated.
        /// </summary>
        string Title { get; set; }

        /// <summary>
        /// The body of the log. This should automatically be populated during SaveLog()
        /// </summary>
        string Body { get; set; }

        /// <summary>
        /// The error metadata
        /// </summary>
        ErrorMetaData ErrorMetaData { get; }

        /// <summary>
        /// The Exception to log
        /// </summary>
        Exception Exception { get; set; }

        /// <summary>
        /// Whether the generated error was handled by the application and hidden from the user
        /// </summary>
        bool HiddenFromUser { get; set; }

        /// <summary>
        /// Whether logging is enabled in the config file
        /// </summary>
        bool IsLoggingEnabled { get; }

        /// <summary>
        /// Performs the relevant logging action in the implementer, but only if IsLoggingEnabled is true
        /// </summary>
        void SaveLog();

        /// <summary>
        /// Resets the properties to their default values.
        /// </summary>
        void Clear();

        /// <summary>
        /// Resets the properties to their default values, sets the Exception property and notifies the PeriodicErrorSummary
        /// that a new error has been thrown.
        /// </summary>
        void StartNewLog(Exception e, bool hiddenFromUser);

        /// <summary>
        /// Resets the properties to their default values, sets the Exception property and notifies the PeriodicErrorSummary
        /// that a new error has been thrown if <paramref name="excludeFromErrorThresholdChecking"/> is true.
        /// </summary>
        void StartNewLog(Exception e, bool hiddenFromUser, bool excludeFromErrorThresholdChecking);
    }
}